using System;
using System.Collections.Generic;
using OhioState.AssetManaged;

namespace OhioState.Graphics.Proxy
{
    [Serializable()]
    public class ClippedDrawableProxy : SharedAsset, IDrawable
    {
        IDrawable drawable;
        public IDrawable Drawable
        {
            get { return drawable; }
            set 
            {
                drawable = value; 
                FireUpdateChangedEvent(this); 
            }
        }
        List<ClipPlaneProxy> clipPlanes = new List<ClipPlaneProxy>(3);
        public List<ClipPlaneProxy> ClipPlanes
        {
            get { return clipPlanes; }
            set { clipPlanes = value; this.FireUpdateChangedEvent(this); }
        }

        public ClippedDrawableProxy(IDrawable drawable, List<ClipPlaneProxy> clipPlanes)
        {
            this.drawable = drawable;
            this.clipPlanes = clipPlanes;
            this.Name = "Clipped" + Drawable.ToString();
            this.Material = Drawable.Material;
        }

        #region IDrawable Members
        public IBoundingVolume BoundingVolume
        {
            get { return this.Drawable.BoundingVolume; }
        }
       
        private MaterialProxy _material;
        public IMaterial Material
        {
            get { return this.Drawable.Material; }
            set
            { this.Drawable.Material = value; }
        }

        public void Render(IRenderPanel panel)
        {
            this.Drawable.Render(panel);
        }
        #endregion      
    }
}
